<?php



/**
	获取当前时间的，前后时间范围
	$around 1过去时间  其他是未来时间
	$type 天数 7，15,30,90,180,365
	return $new_time[
				0=>'1546464646',当前时间戳
				1=>'1564654646',选择天数计算出来的时间戳

			]
*/

function getTime($around=1,$type=7)
{
	$new = time();
	$new_time[] = $new;
	if($around == 1){

		switch ($type) {
			case '7':
					$new_time[] = strtotime("-1weeks",$new);
				break;
			case '15':
					$new_time[] = strtotime("-15days",$new);
				break;
			case '30':
					$new_time[] = strtotime("-1months",$new);
				break;
			case '90':
					$new_time[] = strtotime("-3months",$new);
				break;
			case '180':
					$new_time[] = strtotime("-6months",$new);
				break;
			case '365':
					$new_time[] = strtotime("-1years",$new);
				break;
			default:
					$new_time[] = $new;
				break;
		}

		return $new_time;

	} else {


		switch ($type) {
			case '7':
					$new_time[] = strtotime("+1weeks",$new);
				break;
			case '15':
					$new_time[] = strtotime("+15days",$new);
				break;
			case '30':
					$new_time[] = strtotime("+1months",$new);
				break;
			case '90':
					$new_time[] = strtotime("+3months",$new);
				break;
			case '180':
					$new_time[] = strtotime("+6months",$new);
				break;
			case '365':
					$new_time[] = strtotime("+1years",$new);
				break;
			default:
					$new_time[] = $new;
				break;
		}

		return $new_time;

	}

}